/*****
 * pinia状态持久化
 * 获取缓存的数据并赋值pinia
 */
import { sessions } from 'mosowejs'
import { useLogin,useUserInfo } from './index'
import { storeState } from './index.d'


export default () => { 
  const loginStore: storeState = useLogin()
  const userStore: storeState = useUserInfo()

  loginStore.PI_TOKEN = sessions.get('token') || ''
  loginStore.PI_IS_LOGIN = sessions.get('token') ? true : false  
  userStore.PI_USER_INFO = sessions.get('userInfo') || null
}

